In video compression encoders, control of a degree of quantisation is an important means of controlling the coding process in order to match the capacity demands of the picture behaviour with the available output bit rate. A key parameter used extensively in current coding methods for practical compression applications (e.g. MPEG-2 and MPEG-4/H.264) is the Quantisation Parameter (Qp). Since an increased Qp value results in lower bit rates for the digital video bit stream, for a low target bit rate the value of Qp is at the high end of its nominal range (1 to 31 in MPEG-2, and 0 to 51 in MPEG-4/H.264). Conversely, where bit rate is not severely constrained, a value nearer to the lower end is chosen.
The process linking the target bit rate and the coding process, in particular the value of Qp, is known as Rate Control. The value of Qp is variable within each picture down to the level of a macroblock, but in simple coding implementations is often constant over a whole picture (i.e. fixed rate/non-adaptive quantization) and set at the value suggested by Rate Control. The result of such a simple implementation is that all the macroblocks in a picture contain a similar amount of distortion noise after decoding, regardless of how the macroblocks content and location can cover up the distortion, i.e. the choice of quantization parameter is done regardless of the behaviour of the image and without any recognition of the visible effect of the resultant coding distortions.
Adaptive quantisation, on the other hand, is used to distribute bit allocations within a picture without interfering with the Rate Control algorithm. In general, the picture quality can be improved by reducing the amount of quantisation in picture areas of lower spatial activity (i.e. smooth areas) where the human visual system (HVS) can detect distortion more easily, whereas higher spatial activities are less affected by coarser quantisation because the HVS is less sensitive in picture regions with such high activity levels. However, while some picture sequences benefit from aggressive adaptive quantisation (i.e. large deviations from the average quantisation measured over the whole picture), others are better with little or no adaptive quantisation. This implies that some degree of control is necessary to adapt the value of Qp in a beneficial manner.
An example is shown in FIG. 1, where distortion in the top, grey, smooth area (area A) is much more visible compared with distortion among the spectators (area B). The Qp parameter should therefore be used to lower the distortion in area A and increase the distortion in area B. Compared to using a fixed Qp value over the entire picture, it is preferable to distribute bits from high activity areas to low activity textured areas. Fortunately smooth areas are likely to be more easily compressed so we do not have to increase the Qp that much on the high activity areas for us to be able to lower the Qp enough on the smooth areas.
Adaptive Quantization is not a new idea, but a major problem with existing solutions is how to decide how much of the picture should go in each activity category (high or low). Putting too many of the macroblocks of the picture into the low activity category will distort the high activity category areas, but putting too few of the macroblocks of the picture into the low activity category will make some of the smooth areas end up in the high category, and hence prone to distortion.
Accordingly, there is herein described an improved method of and apparatus for adapting a Quantization parameter for digitally encoding video.